/* eslint-disable array-callback-return */
/* eslint-disable consistent-return */
/* eslint-disable default-case */
/* eslint-disable no-undef */
/* eslint-disable react/destructuring-assignment */
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { LoadingOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Layout, Tree, Spin, Card, Tabs, Row, Button, Divider, Modal, Input } from 'antd';
import queryString from 'query-string';
import moment from 'moment';
import router from 'umi/router';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import Authorized from '@/utils/Authorized';
import StandardTable from '@/components/StandardTable';
import styles from '@/utils/utils.less';
import TextOverFlow from '@/pages/components/TextOverFlow';
import DictCode from '../../components/DictCode';

const { Sider, Content } = Layout;
const { TreeNode } = Tree;
const { TabPane } = Tabs;
const { confirm } = Modal;
const FormItem = Form.Item;
@connect(({ dictionset, loading }) => ({
  dictionset,
  rsgnRsnloading: loading.models.dictionset,
  confirmLoading:
    loading.effects['dictionset/dissAdd'] ||
    loading.effects['dictionset/proAdd'] ||
    loading.effects['dictionset/serTypeAdd'] ||
    loading.effects['dictionset/dissUpdate'] ||
    loading.effects['dictionset/proUpdate'],
  treeloading: loading.effects['dictionset/fetchCorpList'],
}))
@Form.create()
class List extends PureComponent {
  state = {
    autoExpandParent: true,
    tabList: [
      { itemCode: '1', itemName: '离职原因' },
      { itemCode: '2', itemName: '问题人员类型' },
      { itemCode: '3', itemName: '社保服务类型' },
      { itemCode: '4', itemName: '公积金服务类型' },
      { itemCode: '5', itemName: '档案服务类型' },
    ],
    selectedRows: [],
    selectedRowKeys: [],
  };

  componentDidMount() {
    const {
      dispatch,
      location,
      dictionset: { activeKey },
    } = this.props;
    const tempActiveKey = queryString.parse(location.search).activeKey || activeKey;
    this.orgList(tempActiveKey);
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        activeKey: tempActiveKey,
      },
    });
  }

  // 左侧菜单
  orgList = activeKey => {
    const { dispatch } = this.props;
    dispatch({
      type: 'dictionset/fetchCorpList',
      payload: {},
      callback: () => {
        this.getList(activeKey);
      },
    });
  };

  // 右侧表格
  getList = (activeKey = 1, nowPage = 1, pageNum = 10, corpIdParam) => {
    const {
      dispatch,
      dictionset: { corpId },
    } = this.props;
    const corpIdInParam = corpIdParam || corpId;
    const pagerArg = {
      currentPage: nowPage,
      pageSize: pageNum,
    };
    let inParam = {};
    switch (Number(activeKey)) {
      case 1:
        inParam = {
          pagerArg,
          activeKey,
          corpDict: { dictCode: 'RSGN_RSN', corpId: corpIdInParam },
        };
        break;
      case 3:
        inParam = {
          pagerArg,
          activeKey,
          corpDict: { dictCode: 'INS_SERVICE_TYPE ', corpId: corpIdInParam },
        };
        break;
      case 4:
        inParam = {
          pagerArg,
          activeKey,
          corpDict: { dictCode: 'ACCU_SERVICE_TYPE ', corpId: corpIdInParam },
        };
        break;
      case 5:
        inParam = {
          pagerArg,
          activeKey,
          corpDict: { dictCode: 'RCRD_SERVICE_TYPE ', corpId: corpIdInParam },
        };
        break;
      default:
        inParam = { pagerArg, corpId: corpIdInParam, activeKey };
    }
    dispatch({
      type: 'dictionset/fetchPageList',
      payload: inParam,
    });
  };

  onExpand = () => {
    this.setState({
      autoExpandParent: false,
    });
  };

  // 获取树形数据
  getTreeData = (isLeaf, params) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'dictionset/fetchAreaList',
      payload: { params, isLeaf },
    });
  };

  onSelect = selectedKeys => {
    if (selectedKeys.length === 0) {
      return;
    }
    const {
      dispatch,
      dictionset: { activeKey },
    } = this.props;

    this.getList(activeKey, 1, 10, selectedKeys[0]);
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        selectedTreeKeys: selectedKeys,
        corpId: selectedKeys[0],
      },
    });
  };

  handleSelectRows = (selectedRows, selectedKeys) => {
    this.setState({
      selectedRows,
      selectedRowKeys: selectedKeys,
    });
  };

  add = () => {
    const { dispatch, form } = this.props;
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        vno: undefined,
        modalFieldsValue: {},
      },
    });
    form.resetFields();
    this.handleModalVisible(true);
  };

  clickOk = () => {
    const {
      form,
      dispatch,
      dictionset: {
        vno,
        activeKey,
        corpId,
        corpName,
        pageData: { current, pageSize },
        rsgnRsnId,
        probTypeId,
      },
    } = this.props;

    form.validateFieldsAndScroll((err, values) => {
      if (!err) {
        if (!vno) {
          switch (Number(activeKey)) {
            case 1:
              dispatch({
                type: 'dictionset/serTypeAdd',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  dictCode: 'RSGN_RSN',
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
            case 2:
              dispatch({
                type: 'dictionset/proAdd',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
            case 3:
              dispatch({
                type: 'dictionset/serTypeAdd',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  dictCode: 'INS_SERVICE_TYPE',
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
            case 4:
              dispatch({
                type: 'dictionset/serTypeAdd',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  dictCode: 'ACCU_SERVICE_TYPE',
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
            case 5:
              dispatch({
                type: 'dictionset/serTypeAdd',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  dictCode: 'RCRD_SERVICE_TYPE',
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
          }
        } else {
          switch (Number(activeKey)) {
            case 1:
              dispatch({
                type: 'dictionset/dissUpdate',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  vno,
                  rsgnRsnId,
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
            case 2:
              dispatch({
                type: 'dictionset/proUpdate',
                payload: {
                  ...values,
                  corpId,
                  corpName,
                  vno,
                  probTypeId,
                },
                callback: res => {
                  if (res) {
                    this.getList(activeKey, current, pageSize);
                  }
                },
              });
              break;
          }
        }
      }
    });
  };

  onCancel = () => {
    this.handleModalVisible(false);
  };

  handleModalVisible = flag => {
    const { dispatch } = this.props;
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        modalVisible: flag,
      },
    });
  };

  changeTabPane = value => {
    const { location, dispatch } = this.props;
    router.push({
      pathname: location.pathname,
      query: {
        activeKey: value,
      },
    });
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        activeKey: value,
      },
    });
    this.getList(value);
  };

  handleStandardTableChange = pagination => {
    const {
      dictionset: { activeKey },
    } = this.props;
    this.getList(activeKey, pagination.current, pagination.pageSize);
  };

  goDisUpdate = (rsgnRsnId, vno) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        vno,
        rsgnRsnId,
      },
    });
    dispatch({
      type: 'dictionset/fetchModRsnInfo',
      payload: {
        rsgnRsnId,
      },
    });
    this.handleModalVisible(true);
  };

  goProUpdate = (probTypeId, vno) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'dictionset/updateModalData',
      payload: {
        vno,
        probTypeId,
      },
    });
    dispatch({
      type: 'dictionset/fetchModProInfo',
      payload: {
        probTypeId,
      },
    });
    this.handleModalVisible(true);
  };

  delList = (id, vno) => {
    const {
      dispatch,
      dictionset: {
        activeKey,
        pageData: { current, pageSize },
      },
    } = this.props;

    confirm({
      title: '你确定要删除此条信息吗？',
      icon: <ExclamationCircleOutlined />,
      okText: '确定',
      okType: 'primary',
      cancelText: '取消',
      style: { top: 200 },
      onOk: () => {
        switch (Number(activeKey)) {
          case 2:
            dispatch({
              type: 'dictionset/delPro',
              payload: [{ probTypeId: id, vno }],
              callback: res => {
                if (res) {
                  this.getList(activeKey, current, pageSize);
                }
              },
            });
            break;
          case 1:
          case 3:
          case 4:
          case 5:
            dispatch({
              type: 'dictionset/delCorpDictId',
              payload: { corpDictId: id, vno },
              callback: res => {
                if (res) {
                  this.getList(activeKey, current, pageSize);
                }
              },
            });
            break;
        }
      },
      onCancel: () => {},
    });
  };

  // 提交并更新
  save = e => {
    e.preventDefault();
    const {
      form: { validateFieldsAndScroll },
      dispatch,
      dictionset: { pageInfo, corpId, selectedTreeKeys, corpName },
    } = this.props;
    const { vno, paramId } = pageInfo;
    const inParam = { corpId, execCorpId: selectedTreeKeys[0], corpName, vno, paramId };
    validateFieldsAndScroll((err, values) => {
      if (!err) {
        const obj = {};
        Object.keys(values).forEach(item => {
          if (item === 'billGenRule') {
            obj[item] = Number(values[item]);
          } else {
            obj[item] = values[item];
          }
        });
        obj.autoDispch = values.autoDispch || '1';
        obj.autoRcvr = values.autoRcvr || '1';
        dispatch({
          type: 'dictionset/saveParam',
          payload: { ...inParam, ...obj },
        });
      }
    });
  };

  render() {
    const { autoExpandParent } = this.state;
    const hei = window.screen.height;
    const { dictionset, rsgnRsnloading, treeloading, confirmLoading } = this.props;
    const {
      treeData,
      selectedTreeKeys,
      pageData,
      modalVisible,
      modalList,
      activeKey,
      modalFieldsValue,
    } = dictionset;
    const { selectedRows, selectedRowKeys } = this.state;
    const {
      form: { getFieldDecorator },
    } = this.props;
    const formItemLayoutAdd = {
      labelCol: { md: { span: 6 } },
      wrapperCol: { md: { span: 16 } },
    };
    const dissColumns = [
      {
        title: '社保服务类型',
        dataIndex: 'itemName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '备注',
        dataIndex: 'remark',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '创建时间',
        width: 180,
        dataIndex: 'creTime',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: text => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'operation',
        width: 150,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: (text, record) => (
          <div>
            <span
              style={{ color: '#1890FF', cursor: 'pointer' }}
              onClick={() => {
                this.delList(record.corpDictId, record.vno);
              }}
            >
              {' '}
              删除
            </span>
          </div>
        ),
      },
    ];

    const proColumns = [
      {
        title: '问题人员类型',
        dataIndex: 'probTypeName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '问题类型描述',
        dataIndex: 'probTypeDesc',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '所属公司',
        dataIndex: 'corpName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
        render: text => <TextOverFlow text={text} />,
      },
      {
        title: '创建时间',
        width: 180,
        dataIndex: 'creTime',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: text => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'operation',
        width: 150,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: (text, record) => (
          <div>
            <Authorized authority="mgr:probtype:updateprobtype" noMatch={null}>
              <span
                style={{ color: '#1890FF', cursor: 'pointer' }}
                onClick={() => {
                  this.goProUpdate(record.probTypeId, record.vno);
                }}
              >
                修改
              </span>
              <Divider type="vertical" />
            </Authorized>
            <Authorized authority="mgr:probtype:deleteProbType" noMatch={null}>
              <span
                style={{ color: '#1890FF', cursor: 'pointer' }}
                onClick={() => this.delList(record.probTypeId, record.vno)}
              >
                删除
              </span>
            </Authorized>
          </div>
        ),
      },
    ];

    const socialColumns = [
      {
        title: '社保服务类型',
        dataIndex: 'itemName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '备注',
        dataIndex: 'remark',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '创建时间',
        width: 180,
        dataIndex: 'creTime',
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: text => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'operation',
        width: 150,
        onCell: () => ({ style: { textAlign: 'center' } }),
        onHeaderCell: () => ({ style: { fontWeight: 'bold', textAlign: 'center' } }),
        render: (text, record) => (
          <div>
            <span
              style={{ color: '#1890FF', cursor: 'pointer' }}
              onClick={() => {
                this.delList(record.corpDictId, record.vno);
              }}
            >
              {' '}
              删除
            </span>
          </div>
        ),
      },
    ];

    const accuColumns = [
      {
        title: '公积金服务类型',
        dataIndex: 'itemName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '备注',
        dataIndex: 'remark',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '创建时间',
        width: 180,
        dataIndex: 'creTime',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
        render: text => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'operation',
        width: 150,
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
        render: (text, record) => (
          <div>
            <span
              style={{ color: '#1890FF', cursor: 'pointer' }}
              onClick={() => {
                this.delList(record.corpDictId, record.vno);
              }}
            >
              {' '}
              删除
            </span>
          </div>
        ),
      },
    ];

    const rcrdColumns = [
      {
        title: '档案服务类型',
        dataIndex: 'itemName',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '备注',
        dataIndex: 'remark',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
      },
      {
        title: '创建时间',
        width: 180,
        dataIndex: 'creTime',
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
        render: text => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'operation',
        width: 150,
        onHeaderCell: () => ({ style: { fontWeight: 'bold' } }),
        render: (text, record) => (
          <div>
            <span
              style={{ color: '#1890FF', cursor: 'pointer' }}
              onClick={() => {
                this.delList(record.corpDictId, record.vno);
              }}
            >
              {' '}
              删除
            </span>
          </div>
        ),
      },
    ];
    const renderTree = data =>
      data.map(item => {
        if (item.children) {
          return (
            <TreeNode title={item.title} key={item.key} dataRef={item}>
              {renderTree(item.children)}
            </TreeNode>
          );
        }
        return <TreeNode {...item} dataRef={item} />;
      });
    // 离职
    const tabPane1 = (
      <div>
        <Row style={{ marginBottom: 16 }}>
          <Authorized authority="mgr:rsgnrsn:insertrsgnrsn" noMatch={null}>
            <Button type="primary" style={{ marginRight: 20 }} onClick={this.add}>
              <PlusOutlined />
              新增
            </Button>
          </Authorized>
        </Row>
        <StandardTable
          selectedRows={selectedRows}
          selectedRowKeys={selectedRowKeys}
          data={pageData}
          columns={dissColumns}
          rowKey={record => record.rsgnRsnId}
          loading={rsgnRsnloading}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
        />
      </div>
    );
    // 问题
    const tabPane2 = (
      <div>
        <Row style={{ marginBottom: 16 }}>
          <Authorized authority="mgr:probtype:insertprobtype" noMatch={null}>
            <Button type="primary" style={{ marginRight: 20 }} onClick={this.add}>
              <PlusOutlined />
              新增
            </Button>
          </Authorized>
        </Row>
        <StandardTable
          selectedRows={selectedRows}
          selectedRowKeys={selectedRowKeys}
          data={pageData}
          columns={proColumns}
          rowKey={record => record.probTypeId}
          loading={rsgnRsnloading}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
        />
      </div>
    );

    // 社保服务类型
    const tabPane3 = (
      <div>
        <Row style={{ marginBottom: 16 }}>
          <Authorized authority="mgr:insSerTypeApi:insertInsSerType" noMatch={null}>
            <Button type="primary" style={{ marginRight: 20 }} onClick={this.add}>
              <PlusOutlined />
              新增
            </Button>
          </Authorized>
        </Row>
        <StandardTable
          selectedRows={selectedRows}
          selectedRowKeys={selectedRowKeys}
          data={pageData}
          columns={socialColumns}
          rowKey={record => record.insSerTypeId}
          loading={rsgnRsnloading}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
        />
      </div>
    );

    // 公积金服务类型
    const tabPane4 = (
      <div>
        <Row style={{ marginBottom: 16 }}>
          <Authorized authority="mgr:accuSerTypeApi:insertAccuSerType" noMatch={null}>
            <Button type="primary" style={{ marginRight: 20 }} onClick={this.add}>
              <PlusOutlined />
              新增
            </Button>
          </Authorized>
        </Row>
        <StandardTable
          selectedRows={selectedRows}
          selectedRowKeys={selectedRowKeys}
          data={pageData}
          columns={accuColumns}
          rowKey={record => record.accuSerTypeId}
          loading={rsgnRsnloading}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
        />
      </div>
    );

    const tabPane5 = (
      <div>
        <Row style={{ marginBottom: 16 }}>
          <Authorized authority="mgr:rcrdSerTypeApi:insertRcrdSerType" noMatch={null}>
            <Button type="primary" style={{ marginRight: 20 }} onClick={this.add}>
              <PlusOutlined />
              新增
            </Button>
          </Authorized>
        </Row>
        <StandardTable
          selectedRows={selectedRows}
          selectedRowKeys={selectedRowKeys}
          data={pageData}
          columns={rcrdColumns}
          rowKey={record => record.rcrdSerTypeId}
          loading={rsgnRsnloading}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
        />
      </div>
    );
    const tabPaneTem = ['', tabPane1, tabPane2, tabPane3, tabPane4, tabPane5];
    return (
      <PageHeaderWrapper>
        <div>
          <Layout>
            <div className={styles.setSider}>
              <Sider style={{ background: '#fff', width: 274, height: hei }}>
                <div className={styles.setTree} style={{ height: hei }}>
                  {treeloading ? (
                    <div style={{ textAlign: 'center' }}>
                      <LoadingOutlined /> 加载中{' '}
                    </div>
                  ) : (
                    <Tree
                      showLine
                      onSelect={this.onSelect}
                      selectedKeys={selectedTreeKeys}
                      autoExpandParent={autoExpandParent}
                    >
                      {renderTree(treeData)}
                    </Tree>
                  )}
                </div>
              </Sider>
            </div>
            <Content className={styles.contentBody}>
              <Spin tip="Loading..." spinning={rsgnRsnloading}>
                <Card className={styles.tabCard}>
                  <div className={styles.tableList}>
                    <Tabs activeKey={activeKey} onChange={this.changeTabPane}>
                      {this.state.tabList.map(pane => (
                        <TabPane tab={pane.itemName} key={pane.itemCode}>
                          {tabPaneTem[pane.itemCode]}
                        </TabPane>
                      ))}
                    </Tabs>
                  </div>
                </Card>
              </Spin>
            </Content>
          </Layout>
        </div>

        {modalList.map(c => {
          if (Number(c.code) === Number(activeKey)) {
            if (Number(activeKey) >= 3 || Number(activeKey) === 1) {
              return (
                <Modal
                  title={`新增${c.type}`}
                  visible={modalVisible}
                  onOk={this.clickOk}
                  okText="确认"
                  onCancel={this.onCancel}
                  destroyOnClose
                  confirmLoading={confirmLoading}
                >
                  <Form>
                    <FormItem {...formItemLayoutAdd} label={c.type}>
                      {getFieldDecorator('itemCode', {
                        rules: [{ required: true, message: '请选择' }],
                      })(
                        <DictCode
                          allowClear
                          showSearch
                          filterOption={(input, option) =>
                            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                          }
                          dictType={c.serType}
                        />
                      )}
                    </FormItem>
                    <FormItem {...formItemLayoutAdd} label="备注">
                      {getFieldDecorator('remark', {
                        rules: [{ required: false, message: '请输入不超过100个字符' }],
                      })(<Input placeholder="请输入不超过100个字符" maxLength={100} />)}
                    </FormItem>
                  </Form>
                </Modal>
              );
            }
            // if (Number(activeKey) === 1) {
            //   return (
            //     <Modal
            //       title={`新增${c.type}`}
            //       visible={modalVisible}
            //       onOk={this.clickOk}
            //       okText="确认"
            //       onCancel={this.onCancel}
            //       confirmLoading={confirmLoading}
            //     >
            //       <Form>
            //         <FormItem {...formItemLayoutAdd} label="离职原因">
            //           {getFieldDecorator('rsgnRsnName', {
            //             rules: [{ required: true, message: '请输入字数不超过40的离职原因！' }],
            //             initialValue: modalFieldsValue.rsgnRsnName,
            //           })(<Input placeholder="请输入字数不超过40的离职原因" maxLength={40} />)}
            //         </FormItem>
            //         <FormItem {...formItemLayoutAdd} label="离职原因编码">
            //           {getFieldDecorator('rsgnRsnCode', {
            //             rules: [
            //               {
            //                 required: false,
            //                 message: '请输入不超过10位阿拉伯数字',
            //                 pattern: /^[0-9]*$/,
            //               },
            //             ],
            //             initialValue: modalFieldsValue.rsgnRsnCode,
            //           })(<Input placeholder="请输入不超过10位阿拉伯数字" maxLength={10} />)}
            //         </FormItem>
            //         <FormItem {...formItemLayoutAdd} label="备注">
            //           {getFieldDecorator('remark', {
            //             rules: [{ required: false, message: '请输入字数不超过200的备注！' }],
            //             initialValue: modalFieldsValue.remark,
            //           })(<Input placeholder="请输入字数不超过200的备注" maxLength={200} />)}
            //         </FormItem>
            //       </Form>
            //     </Modal>
            //   );
            // }
            if (Number(activeKey) === 2) {
              return (
                <Modal
                  title={`新增${c.type}`}
                  visible={modalVisible}
                  onOk={this.clickOk}
                  okText="确认"
                  onCancel={this.onCancel}
                  confirmLoading={confirmLoading}
                >
                  <Form>
                    <FormItem {...formItemLayoutAdd} label="问题人员类型">
                      {getFieldDecorator('probTypeName', {
                        rules: [{ required: true, message: '请输入问题人员类型' }],
                        initialValue: modalFieldsValue.probTypeName,
                      })(<Input placeholder="请输入不超过20个字符" maxLength={20} />)}
                    </FormItem>
                    <FormItem {...formItemLayoutAdd} label="问题类型描述">
                      {getFieldDecorator('probTypeDesc', {
                        rules: [{ required: false, message: '请输入问题类型描述' }],
                        initialValue: modalFieldsValue.probTypeDesc,
                      })(<Input placeholder="请输入不超过100个字符" maxLength={100} />)}
                    </FormItem>
                  </Form>
                </Modal>
              );
            }
          }
        })}
      </PageHeaderWrapper>
    );
  }
}

export default List;
